package com.op.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.op.mapper.QuestionTagsMapper;
import com.op.entity.QuestionTags;
import com.op.service.QuestionTagsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (QuestionTags)表服务实现类
 *
 * @author 孤焰
 * @since 2021-10-05 08:49:12
 */
@Service("questionTagsService")
public class QuestionTagsServiceImpl extends ServiceImpl<QuestionTagsMapper, QuestionTags> implements QuestionTagsService {
    @Resource
    QuestionTagsMapper questionTagsMapper;

    @Override
    public List<QuestionTags> selectAllLike(QuestionTags questionTags) {
        LambdaQueryWrapper<QuestionTags> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper
                .eq(questionTags.getId() != null, QuestionTags::getId, questionTags.getId())
                .like(StringUtils.isNotBlank(questionTags.getTag()), QuestionTags::getTag, questionTags.getTag())
                .eq(questionTags.getStatus() != null, QuestionTags::getStatus, questionTags.getStatus());
        return questionTagsMapper.selectList(lambdaQueryWrapper);
    }
}

